package com.itmuch.usercenter;

import com.itmuch.usercenter.dao.user.UserMapper;
import com.itmuch.usercenter.domain.entity.user.User;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author caiqian
 * @date 2021/5/6 14:38
 */
@RestController
public class TestController {

  @Autowired
  private UserMapper userMapper;

  @GetMapping("/test")
  public User testInsert(){
    User user = new User();
    user.setAvatarUrl("xxx");
    user.setBonus(100);
    user.setCreateTime(new Date());
    user.setUpdateTime(new Date());

    userMapper.insertSelective(user);

    return user;
  }

  //请求示例 q?id=xxx&wxid=xxx...
  @GetMapping("/q")
  public User query(User user){
    return user;
  }
}
